<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login2.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    
    <%
    String name =(String)session.getAttribute("user");
    if(name==null)
   request.getRequestDispatcher("index.jsp").forward(request, response);%>
   
   Session user is :    <%= name %>

    <a href="index.jsp" >remove session</a><%--how to user the link to remove session --%>
    
    <%
    pageContext.setAttribute("name", "MLDN");
    pageContext.setAttribute("date",new Date());
    //属性范围
    request.setAttribute("name", "request");
    request.setAttribute("date", new Date());
    
     %>
  <jsp:forward page="login3.jsp"/>
  <input value="forward link" name ="a" type="button" onclick="<jsp:forward page="login3.jsp"/>">
  </body>
</html>
